import api from '@/http/index'

/* 列表 */
export const getTablesList = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/Role/GetGridJson', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 获取模块 */
export const getModules = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/Module/ModulesButtons', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 新建 */
export const addTablesItem = (data) => {
    return new Promise((resolve, reject) => {
        api.post('/api/Role/SubmitForm', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 停用 */
export const dleTablesItem = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/Role/DeleteRole', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 启用 */
export const startTablesItem = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/Role/EnabledRole', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 根据ID查询详细信息 */
export const getItemInfo = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/Role/GetFormJson', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};